ECMAScript

ECMAScript is the required scripting language for VoiceXML (using the <script> element). This section contains additional information about using ECMAScript to access logging and web service facilities.

Note: Java system properties are defined in the vocalos.conf (Windows) file.

Accessing the log4j Logger

You can access the log4j logger from within the ECMAScript of your application (executed in the browser). To do this, set the Java System property vocalos.data.webservice to true (the default is false).

The following is an example of how you would access the log4j logger from within an ECMAScript script.

if (Log.isDebugEnabled())

{

Log.debug("Variable value is: " + var);

}

 

Accessing Web Services

You can access Web Services from within the ECMAscript of your application (executed in the browser). To do this, set the Java System property vocalos.data.webservice to "true" (the default is false).

When activated, the browser will insert a helper variable named "WebService" which exposes one method named "create" with the signature.

org.apache.axis.client.Call create (String url)

throws MalformedURLException;

You can create an AXIS call object from within your script by calling:.

Call call = WebService.create("http://home/index");

call.invoke("myservice",null);

For more information about using AXIS, go to http://ws.apache.org/axis/.